package test.study.async.reactor.scheduler_on;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;
import study.async.reactor.support.utils.SleepUtils;

@Slf4j
public class _3_ {

    @Test
    public void test() {

        Mono.just("hello")
                .map(e -> {
                    log.info("Map 1, the value map to: {}", e);
                    return e + "aa";
                }).subscribeOn(Schedulers.single())
                .map(e -> {
                    log.info("Map 2, the value map to: {}", e);
                    return e + "bb";
                }).subscribeOn(Schedulers.newParallel("parallel"))
                .map(e -> {
                    log.info("Map 3, the value map to: {}", e);
                    return e + "cc";
                })
                .subscribe(e -> {
                    log.info("ssssssssssssssssssssssssssssssss");
                });

        SleepUtils.sleepFor(4);
    }
}
